package com.example.tigering.config;

import com.example.tigering.filter.TestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: xwg
 * @CreateDate: 2023/8/21
 */
//https://gitee.com/xieweig/tigering
@Configuration
public class ResourceConfig implements WebMvcConfigurer {
    @Autowired
    private TestInterceptor testInterceptor;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**")
//                .addResourceLocations("file:"+"D:/profile"+"/");
                .addResourceLocations("file:"+"/home/xieweig/ry"+"/");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(testInterceptor).order(-100);
    }
}
